﻿import com.mixmedia.mx.MovieClipLoaderEvt;
import com.mixmedia.net.ILoadStrategy;

/**
 * @author colin
 * responsible to create and kill preloader
 */
class com.mixmedia.net.LoadSWF implements ILoadStrategy {
	private var target:MovieClip;
	private var mcImageLoader:MovieClip;
	private var mcl:MovieClipLoaderEvt;
	private var request:String;

	public function LoadSWF(target:MovieClip){
		if(target==undefined)trace('com.mixmedia.net.LoadSWF require target movieclip');
		this.target = target;
		mcImageLoader = target.createEmptyMovieClip("mcImageLoader",10);
		mcl = new MovieClipLoaderEvt();
	}
	
	public function load(requestURL:String):Void {
		mcl.loadClip(requestURL,mcImageLoader);
	}

	public function getTarget() : Object {
		return mcl;
	}

	public function addEventListener(event : String, handler) : Void {
		mcl.addEventListener(event,handler);
	}

	public function removeEventListener(event : String, handler) : Void {
		mcl.removeEventListener(event, handler);
	}
}